//
//  MSIAPHelper.h
//  MagazineShangejie
//
//  Created by chenli on 14-1-9.
//  Copyright (c) 2014年 osgit. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
//#import "MSSubscribeProduct.h"

typedef void (^ProductsDone) (SKProductsResponse *response);
typedef void (^BuyProduct) (id responseObject);
typedef void (^FailedProduct)(SKRequest *request);
typedef void (^RestoreTransaction) (SKPaymentTransaction *transaction);
typedef void (^FailedTransaction) (SKPaymentTransaction *transaction);
typedef void (^CompleteTransaction) (SKPaymentTransaction *transaction);

@interface MSIAPHelper : NSObject<SKProductsRequestDelegate,SKPaymentTransactionObserver>{
    NSMutableDictionary *mag_Info;
}

@property (retain) NSSet *productIdentifiers;
@property (retain) NSMutableArray * products;
@property (retain) NSMutableSet *purchasedProducts;

@property (copy,nonatomic) ProductsDone        productsDone;
@property (copy,nonatomic) BuyProduct          buyproduct;
@property (copy,nonatomic) RestoreTransaction  restore;
@property (copy,nonatomic) FailedTransaction   failed;
@property (copy,nonatomic) FailedProduct       failedProduct;
@property (copy,nonatomic) CompleteTransaction complete;

- (void)requestProducts:(void(^)(SKProductsResponse *response))done Failed:(void(^)(SKRequest *request))failed;


- (void)buyProductIdentifier:(SKProduct *)product
                    magaInfo:(NSDictionary *)info
              buyProductDone:(void(^)(id responseObject))done
                     Restore:(void(^)(SKPaymentTransaction *transaction))restore
                      Failed:(void(^)(SKPaymentTransaction *transaction))failed
                    Complete:(void(^)(SKPaymentTransaction *transaction))complete;
@end
